package com.carpedil.redis.queue;

import java.util.concurrent.ArrayBlockingQueue;

/** @author Administrator */
public class InThread implements Runnable {
  ArrayBlockingQueue<String> queue = null;

  public InThread(ArrayBlockingQueue<String> queue) {
    this.queue = queue;
  }

  @Override
  public void run() {
    int i = 0;
    while (true) {
      try {
        queue.put("馒头" + i);
        System.out.println(Thread.currentThread().getName() + "放入馒头" + i);
        i++;
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}
